---
permalink: "/behaviors/advanced/dispatch-multiple/index.xml"
tags: "Behaviors/Advanced"
hv_title: "Dispatch Events Multiple"
hv_button_behavior: "back"
---
{% extends 'templates/base.xml.njk' %}
{% from 'macros/description/index.xml.njk' import description %}

{% block styles %}
  <style id="item-added" color="green" fontSize="18" fontWeight="normal"/>
  <style id="item-add" color="blue" fontSize="18" fontWeight="normal"/>
{% endblock %}

{% block container %}
  {{ description("The items below will respond to different events for independent status updates.") }}
  {{ description("Contacts:") }}
  {% macro item(item_style, name, index) %}
    <item key="{{index}}" style="{{item_style}}" href="/hyperview/public/behaviors/advanced/dispatch-multiple/item-{{index}}.xml">
      <text style="item-label">{{name}}</text>
      {{ caller() }}
      <view hide="true">
        <text id="added" style="item-added">Added</text>
      </view>
    </item>
  {% endmacro %}

  <list>
    {% call item("item item-first", "Jeeves", "1") -%}
      <text
        id="add-item-1"
        action="replace"
        event-name="added-item1"
        trigger="on-event"
        href="#added"
        style="item-add"
      >
        Add
      </text>
    {%- endcall %}

    {% call item("item", "Wooster", "2") -%}
      <text
        id="add-item-2"
        action="replace"
        event-name="added-item2"
        trigger="on-event"
        href="#added"
        style="item-add"
      >
        Add
      </text>
    {%- endcall %}

    {% call item("item item-last", "Wooster", "3") -%}
      <text
        id="add-item-3"
        action="replace"
        event-name="added-item3"
        trigger="on-event"
        href="#added"
        style="item-add"
      >
        Add
      </text>
    {%- endcall %}
  </list>
{% endblock %}
